.class public Lcom/instagram/android/service/PendingMediaService;
.super Landroid/app/IntentService;
.source "PendingMediaService.java"


# static fields
.field private static final d:Lcom/instagram/pendingmedia/b/a;

.field private static e:Lcom/instagram/pendingmedia/b/c;

.field private static f:Z


# instance fields
.field private final a:Landroid/os/IBinder;

.field private b:Z

.field private c:Lcom/instagram/creation/video/h/a;

.field private final g:Ljava/lang/Object;

.field private volatile h:Landroid/os/PowerManager$WakeLock;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 89
    invoke-static {}, Lcom/instagram/pendingmedia/b/a;->a()Lcom/instagram/pendingmedia/b/a;

    move-result-object v0

    sput-object v0, Lcom/instagram/android/service/PendingMediaService;->d:Lcom/instagram/pendingmedia/b/a;

    .line 90
    invoke-static {}, Lcom/instagram/pendingmedia/b/c;->a()Lcom/instagram/pendingmedia/b/c;

    move-result-object v0

    sput-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    .line 93
    const/4 v0, 0x0

    sput-boolean v0, Lcom/instagram/android/service/PendingMediaService;->f:Z

    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 143
    const-string v0, "PendingMediaService"

    invoke-direct {p0, v0}, Landroid/app/IntentService;-><init>(Ljava/lang/String;)V

    .line 85
    new-instance v0, Lcom/instagram/android/service/n;

    invoke-direct {v0, p0}, Lcom/instagram/android/service/n;-><init>(Lcom/instagram/android/service/PendingMediaService;)V

    iput-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->a:Landroid/os/IBinder;

    .line 96
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->g:Ljava/lang/Object;

    .line 144
    return-void
.end method

.method public static a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 598
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->d:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->b(Lcom/instagram/pendingmedia/model/e;)V

    .line 599
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 600
    return-void
.end method

.method private static a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V
    .locals 4
    .parameter
    .parameter
    .parameter

    .prologue
    .line 581
    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    .line 583
    new-instance v1, Landroid/content/Intent;

    const-class v2, Lcom/instagram/android/service/PendingMediaService;

    invoke-direct {v1, v0, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 585
    const-string v2, "PendingMediaService.INTENT_EXTRA_PERFORM_ACTION"

    invoke-virtual {v1, v2, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 586
    const-string v2, "PendingMediaService.INTENT_EXTRA_PENDING_MEDIA_ID"

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->a()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 588
    invoke-virtual {v0, v1}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    .line 589
    return-void
.end method

.method private a(Lcom/instagram/j/l;Lcom/instagram/pendingmedia/model/c;)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 525
    new-instance v0, Ljava/io/File;

    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->q()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 526
    invoke-static {v0}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/instagram/j/l;->a(Landroid/net/Uri;)V

    .line 529
    invoke-virtual {p1}, Lcom/instagram/j/l;->g()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Lcom/instagram/pendingmedia/model/c;->g(Ljava/lang/String;)V

    .line 531
    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v0

    sget-object v1, Lcom/instagram/model/a/a;->b:Lcom/instagram/model/a/a;

    if-ne v0, v1, :cond_0

    .line 532
    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->r()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/instagram/j/l;->h(Ljava/lang/String;)V

    .line 535
    :cond_0
    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->M()Z

    move-result v0

    if-nez v0, :cond_3

    .line 536
    invoke-virtual {p1}, Lcom/instagram/j/l;->b()Lcom/instagram/android/model/b/e;

    move-result-object v0

    .line 537
    invoke-virtual {v0}, Lcom/instagram/android/model/b/e;->s()V

    .line 539
    invoke-virtual {v0}, Lcom/instagram/android/model/b/e;->r()Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1

    const/4 v2, 0x1

    if-ne v1, v2, :cond_2

    .line 541
    invoke-static {}, Lcom/instagram/service/d;->a()Lcom/instagram/service/d;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/instagram/service/d;->b(Lcom/instagram/android/model/b/e;)Lcom/instagram/android/model/b/e;

    .line 546
    :goto_0
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->g()V

    .line 557
    :goto_1
    invoke-static {}, Lcom/instagram/m/b/a;->a()Lcom/instagram/m/b/a;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/m/b/a;->r()Z

    move-result v0

    if-nez v0, :cond_1

    .line 558
    invoke-static {}, Lcom/instagram/android/support/camera/d;->d()V

    .line 560
    :cond_1
    return-void

    .line 543
    :cond_2
    invoke-virtual {v0}, Lcom/instagram/android/model/b/e;->y()V

    goto :goto_0

    .line 549
    :cond_3
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    invoke-static {v0, v1}, Lcom/instagram/android/service/q;->a(J)V

    .line 552
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/instagram/android/service/UserService;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 553
    const-string v1, "suggestions"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;

    .line 554
    invoke-virtual {p0, v0}, Lcom/instagram/android/service/PendingMediaService;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    goto :goto_1
.end method

.method private a(Lcom/instagram/pendingmedia/model/c;)V
    .locals 2
    .parameter

    .prologue
    const/4 v1, 0x0

    .line 179
    iput-boolean v1, p0, Lcom/instagram/android/service/PendingMediaService;->b:Z

    .line 182
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V

    .line 184
    const/4 v0, 0x1

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->g(Z)V

    .line 186
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->b(Lcom/instagram/pendingmedia/model/c;)V

    .line 190
    iget-boolean v0, p0, Lcom/instagram/android/service/PendingMediaService;->b:Z

    if-eqz v0, :cond_0

    .line 191
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->b(Lcom/instagram/pendingmedia/model/c;)V

    .line 194
    :cond_0
    invoke-virtual {p1, v1}, Lcom/instagram/pendingmedia/model/c;->g(Z)V

    .line 195
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->d:Lcom/instagram/pendingmedia/b/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/a;->e()V

    .line 196
    return-void
.end method

.method private a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 659
    invoke-virtual {p0}, Lcom/instagram/android/service/PendingMediaService;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/instagram/n/h;->a(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 660
    new-instance v0, Lcom/instagram/b/b;

    const-string v1, "media_upload_failure"

    const/4 v2, 0x0

    invoke-direct {v0, v1, v2}, Lcom/instagram/b/b;-><init>(Ljava/lang/String;Lcom/instagram/b/d;)V

    .line 661
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v1

    sget-object v2, Lcom/instagram/model/a/a;->a:Lcom/instagram/model/a/a;

    if-ne v1, v2, :cond_3

    .line 662
    const-string v1, "media_type"

    const-string v2, "photo"

    invoke-virtual {v0, v1, v2}, Lcom/instagram/b/b;->a(Ljava/lang/String;Ljava/lang/String;)Lcom/instagram/b/b;

    .line 666
    :cond_0
    :goto_0
    if-eqz p2, :cond_1

    .line 667
    const-string v1, "reason"

    invoke-virtual {v0, v1, p2}, Lcom/instagram/b/b;->a(Ljava/lang/String;Ljava/lang/String;)Lcom/instagram/b/b;

    .line 669
    :cond_1
    invoke-static {}, Lcom/instagram/b/a;->a()Lcom/instagram/b/c;

    move-result-object v1

    invoke-interface {v1, v0}, Lcom/instagram/b/c;->a(Lcom/instagram/b/b;)V

    .line 671
    :cond_2
    return-void

    .line 663
    :cond_3
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v1

    sget-object v2, Lcom/instagram/model/a/a;->b:Lcom/instagram/model/a/a;

    if-ne v1, v2, :cond_0

    .line 664
    const-string v1, "media_type"

    const-string v2, "video"

    invoke-virtual {v0, v1, v2}, Lcom/instagram/b/b;->a(Ljava/lang/String;Ljava/lang/String;)Lcom/instagram/b/b;

    goto :goto_0
.end method

.method private a(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 563
    new-instance v0, Landroid/content/Intent;

    const-string v1, "PendingMediaService.BROADCAST_INTENT_CHECKPOINT_REQUIRED"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 564
    const-string v1, "checkpointUrl"

    invoke-virtual {v0, v1, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 565
    invoke-static {v0}, Lcom/instagram/n/d;->a(Landroid/content/Intent;)Z

    .line 566
    return-void
.end method

.method public static a()Z
    .locals 2

    .prologue
    const/4 v0, 0x0

    .line 128
    sget-boolean v1, Lcom/instagram/android/service/PendingMediaService;->f:Z

    if-eqz v1, :cond_0

    .line 129
    sput-boolean v0, Lcom/instagram/android/service/PendingMediaService;->f:Z

    .line 130
    const/4 v0, 0x1

    .line 132
    :cond_0
    return v0
.end method

.method public static b(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 610
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->d:Lcom/instagram/pendingmedia/b/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/a;->b()V

    .line 611
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->d:Lcom/instagram/pendingmedia/b/a;

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->a()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1, p1}, Lcom/instagram/pendingmedia/b/a;->a(Ljava/lang/String;Lcom/instagram/pendingmedia/model/c;)V

    .line 612
    invoke-static {}, Lcom/instagram/pendingmedia/b/c;->a()Lcom/instagram/pendingmedia/b/c;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->b()V

    .line 613
    return-void
.end method

.method private b(Lcom/instagram/pendingmedia/model/c;)V
    .locals 2
    .parameter

    .prologue
    .line 199
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v0

    sget-object v1, Lcom/instagram/model/a/a;->a:Lcom/instagram/model/a/a;

    if-ne v0, v1, :cond_1

    .line 200
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->c(Lcom/instagram/pendingmedia/model/c;)V

    .line 204
    :cond_0
    :goto_0
    return-void

    .line 201
    :cond_1
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v0

    sget-object v1, Lcom/instagram/model/a/a;->b:Lcom/instagram/model/a/a;

    if-ne v0, v1, :cond_0

    .line 202
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->d(Lcom/instagram/pendingmedia/model/c;)V

    goto :goto_0
.end method

.method public static c(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 616
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->b(Lcom/instagram/pendingmedia/model/e;)V

    .line 617
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 618
    return-void
.end method

.method private c(Lcom/instagram/pendingmedia/model/c;)V
    .locals 3
    .parameter

    .prologue
    .line 207
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->a:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_0

    sget-object v0, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-static {v0, v1}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 210
    :try_start_0
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "upload_photo"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 211
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->g(Lcom/instagram/pendingmedia/model/c;)V

    .line 212
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "upload_photo"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 219
    :cond_0
    :goto_0
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_1

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_1

    .line 222
    :try_start_1
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "configure_media"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 223
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->h(Lcom/instagram/pendingmedia/model/c;)V

    .line 224
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "configure_media"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1

    .line 230
    :cond_1
    :goto_1
    return-void

    .line 213
    :catch_0
    move-exception v0

    .line 214
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Photo upload failed: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 215
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed upload"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 225
    :catch_1
    move-exception v0

    .line 226
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Failed on configure: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 227
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed configure"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1
.end method

.method private d()Landroid/os/PowerManager$WakeLock;
    .locals 3

    .prologue
    .line 103
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->h:Landroid/os/PowerManager$WakeLock;

    if-nez v0, :cond_0

    .line 104
    invoke-virtual {p0}, Lcom/instagram/android/service/PendingMediaService;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    const-string v1, "power"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/PowerManager;

    const/4 v1, 0x1

    const-string v2, "PendingMediaService.WakeLock"

    invoke-virtual {v0, v1, v2}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->h:Landroid/os/PowerManager$WakeLock;

    .line 106
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->h:Landroid/os/PowerManager$WakeLock;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/os/PowerManager$WakeLock;->setReferenceCounted(Z)V

    .line 108
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->h:Landroid/os/PowerManager$WakeLock;

    return-object v0
.end method

.method public static d(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 621
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->b(Lcom/instagram/pendingmedia/model/e;)V

    .line 622
    const/4 v0, 0x0

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->f(Ljava/lang/String;)V

    .line 623
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 624
    return-void
.end method

.method private d(Lcom/instagram/pendingmedia/model/c;)V
    .locals 4
    .parameter

    .prologue
    .line 236
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->d:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_1

    sget-object v0, Lcom/instagram/pendingmedia/model/e;->e:Lcom/instagram/pendingmedia/model/e;

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    sget-object v2, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-static {v0, v1, v2}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->A()Ljava/util/List;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->A()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->A()Ljava/util/List;

    move-result-object v0

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/j;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/j;->a()Ljava/util/Date;

    move-result-object v0

    new-instance v1, Ljava/util/Date;

    invoke-direct {v1}, Ljava/util/Date;-><init>()V

    invoke-virtual {v0, v1}, Ljava/util/Date;->compareTo(Ljava/util/Date;)I

    move-result v0

    if-gtz v0, :cond_1

    .line 243
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Ljava/util/List;)V

    .line 244
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->a:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Lcom/instagram/pendingmedia/model/e;)V

    .line 247
    :cond_1
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->a:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_2

    sget-object v0, Lcom/instagram/pendingmedia/model/e;->d:Lcom/instagram/pendingmedia/model/e;

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->e:Lcom/instagram/pendingmedia/model/e;

    sget-object v2, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    sget-object v3, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-static {v0, v1, v2, v3}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;Ljava/lang/Enum;Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 255
    :try_start_0
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->e(Lcom/instagram/pendingmedia/model/c;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 262
    :cond_2
    :goto_0
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->d:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_6

    sget-object v0, Lcom/instagram/pendingmedia/model/e;->e:Lcom/instagram/pendingmedia/model/e;

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    sget-object v2, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-static {v0, v1, v2}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_6

    .line 266
    :try_start_1
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->r()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_3

    .line 268
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->f(Lcom/instagram/pendingmedia/model/c;)V

    .line 272
    :cond_3
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->r()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_5

    .line 273
    const-string v0, "Could not render video"

    invoke-direct {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 274
    const-string v0, "PendingMediaService"

    const-string v1, "Could not render video"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2

    .line 320
    :cond_4
    :goto_1
    return-void

    .line 256
    :catch_0
    move-exception v0

    .line 257
    const-string v1, "Video Upload URL request failed"

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 258
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed new media request"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 278
    :cond_5
    :try_start_2
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->r()Ljava/lang/String;

    move-result-object v0

    const-string v1, "video/x-matroska"

    invoke-static {p0, v0, v1}, Lcom/instagram/creation/base/g;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 280
    new-instance v0, Lcom/instagram/android/service/y;

    invoke-static {}, Lcom/instagram/android/d/a/a;->a()Lcom/instagram/android/d/a/a;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/instagram/android/service/y;-><init>(Lcom/instagram/android/d/a/a;)V

    .line 281
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v1

    const-string v2, "upload_video"

    invoke-interface {v1, v2}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 282
    invoke-virtual {v0, p1}, Lcom/instagram/android/service/y;->a(Lcom/instagram/pendingmedia/model/c;)Lcom/instagram/android/service/aa;

    move-result-object v0

    .line 283
    sget-object v1, Lcom/instagram/android/service/aa;->b:Lcom/instagram/android/service/aa;

    if-ne v0, v1, :cond_8

    .line 284
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/android/service/PendingMediaService;->b:Z

    .line 285
    const-string v0, "All video upload URLs expired"

    invoke-direct {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2

    .line 296
    :cond_6
    :goto_2
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->e:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_7

    sget-object v0, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-static {v0, v1}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v0

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_7

    .line 300
    :try_start_3
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "upload_cover_photo"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 301
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->g(Lcom/instagram/pendingmedia/model/c;)V

    .line 302
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "upload_cover_photo"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_3

    .line 309
    :cond_7
    :goto_3
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_4

    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v0

    sget-object v1, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-ne v0, v1, :cond_4

    .line 312
    :try_start_4
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "configure_media"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 313
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->h(Lcom/instagram/pendingmedia/model/c;)V

    .line 314
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "configure_media"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1

    goto/16 :goto_1

    .line 315
    :catch_1
    move-exception v0

    .line 316
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Failed on configure: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 317
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed configure"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_1

    .line 286
    :cond_8
    :try_start_5
    sget-object v1, Lcom/instagram/android/service/aa;->a:Lcom/instagram/android/service/aa;

    if-ne v0, v1, :cond_6

    .line 287
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "upload_video"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V

    .line 288
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_2

    goto/16 :goto_2

    .line 290
    :catch_2
    move-exception v0

    .line 291
    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 292
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed video render/upload"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_2

    .line 303
    :catch_3
    move-exception v0

    .line 304
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Cover photo upload failed: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 305
    const-string v1, "PendingMediaService"

    const-string v2, "Media failed cover photo upload"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_3
.end method

.method private e()V
    .locals 2

    .prologue
    .line 112
    iget-object v1, p0, Lcom/instagram/android/service/PendingMediaService;->g:Ljava/lang/Object;

    monitor-enter v1

    .line 113
    :try_start_0
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->d()Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->isHeld()Z

    move-result v0

    if-nez v0, :cond_0

    .line 114
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->d()Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->acquire()V

    .line 116
    :cond_0
    monitor-exit v1

    .line 117
    return-void

    .line 116
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public static e(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 635
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->M()Z

    move-result v0

    if-nez v0, :cond_0

    .line 636
    const/4 v0, 0x1

    sput-boolean v0, Lcom/instagram/android/service/PendingMediaService;->f:Z

    .line 639
    :cond_0
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->b(Lcom/instagram/pendingmedia/model/e;)V

    .line 640
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 643
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->b()V

    .line 644
    return-void
.end method

.method private e(Lcom/instagram/pendingmedia/model/c;)V
    .locals 4
    .parameter

    .prologue
    .line 323
    new-instance v0, Lcom/instagram/android/d/g/g;

    invoke-direct {v0, p1}, Lcom/instagram/android/d/g/g;-><init>(Lcom/instagram/pendingmedia/model/c;)V

    .line 324
    invoke-static {}, Lcom/instagram/android/d/a/a;->a()Lcom/instagram/android/d/a/a;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/instagram/android/d/a/a;->a(Lcom/instagram/android/d/c/g;)Lch/boye/httpclientandroidlib/HttpResponse;

    move-result-object v0

    .line 326
    if-eqz v0, :cond_0

    invoke-interface {v0}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v1

    invoke-interface {v1}, Lch/boye/httpclientandroidlib/StatusLine;->getStatusCode()I

    move-result v1

    const/16 v2, 0xc8

    if-ne v1, v2, :cond_0

    .line 330
    invoke-interface {v0}, Lch/boye/httpclientandroidlib/HttpResponse;->getEntity()Lch/boye/httpclientandroidlib/HttpEntity;

    move-result-object v0

    invoke-static {v0}, Lch/boye/httpclientandroidlib/util/EntityUtils;->toString(Lch/boye/httpclientandroidlib/HttpEntity;)Ljava/lang/String;

    move-result-object v0

    .line 331
    new-instance v1, Lcom/instagram/android/v/a/b/a;

    invoke-static {}, Lcom/instagram/android/service/f;->a()Lcom/instagram/android/service/f;

    move-result-object v2

    const-class v3, Lcom/fasterxml/jackson/databind/JsonNode;

    invoke-virtual {v2, v0, v3}, Lcom/instagram/android/service/f;->readValue(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/fasterxml/jackson/databind/JsonNode;

    invoke-direct {v1, v0}, Lcom/instagram/android/v/a/b/a;-><init>(Lcom/fasterxml/jackson/databind/JsonNode;)V

    .line 334
    invoke-virtual {v1}, Lcom/instagram/android/v/a/b/a;->a()Ljava/util/List;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Ljava/util/List;)V

    .line 335
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->d:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Lcom/instagram/pendingmedia/model/e;)V

    .line 337
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V

    .line 339
    :cond_0
    return-void
.end method

.method private f()V
    .locals 2

    .prologue
    .line 120
    iget-object v1, p0, Lcom/instagram/android/service/PendingMediaService;->g:Ljava/lang/Object;

    monitor-enter v1

    .line 121
    :try_start_0
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->d()Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->isHeld()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 122
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->d()Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 124
    :cond_0
    monitor-exit v1

    .line 125
    return-void

    .line 124
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public static f(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 647
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 648
    return-void
.end method

.method private f(Lcom/instagram/pendingmedia/model/c;)V
    .locals 4
    .parameter

    .prologue
    const/4 v3, 0x0

    .line 344
    :try_start_0
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->e()V

    .line 346
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "render_video"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->a(Ljava/lang/String;)V

    .line 347
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->e()I

    move-result v0

    invoke-static {p0, v0}, Lcom/instagram/creation/video/e/q;->a(Landroid/content/Context;I)Lcom/instagram/creation/video/e/p;

    move-result-object v0

    .line 348
    invoke-static {}, Lcom/instagram/creation/video/c/b;->e()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 349
    new-instance v1, Lcom/instagram/creation/video/h/d;

    invoke-direct {v1, p0, p1, v0}, Lcom/instagram/creation/video/h/d;-><init>(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;Lcom/instagram/creation/video/e/p;)V

    .line 350
    new-instance v0, Ljava/lang/Thread;

    invoke-virtual {v1}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    .line 351
    iput-object v1, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    .line 352
    invoke-virtual {v1}, Lcom/instagram/creation/video/h/d;->s()V

    .line 353
    invoke-virtual {v1}, Lcom/instagram/creation/video/h/d;->h()V

    .line 358
    :goto_0
    invoke-static {}, Lcom/instagram/b/a;->b()Lcom/instagram/b/g;

    move-result-object v0

    const-string v1, "render_video"

    invoke-interface {v0, v1}, Lcom/instagram/b/g;->b(Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 361
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->f()V

    .line 362
    iput-object v3, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    .line 365
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V

    .line 366
    return-void

    .line 355
    :cond_0
    :try_start_1
    new-instance v1, Lcom/instagram/creation/video/h/c;

    invoke-direct {v1, p0, p1, v0}, Lcom/instagram/creation/video/h/c;-><init>(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;Lcom/instagram/creation/video/e/p;)V

    iput-object v1, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    .line 356
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/a;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/creation/video/gl/l;->run()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 361
    :catchall_0
    move-exception v0

    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->f()V

    .line 362
    iput-object v3, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    throw v0
.end method

.method private g()V
    .locals 1

    .prologue
    .line 569
    const-string v0, "PendingMediaService.BROADCAST_INTENT_NEW_MEDIA"

    invoke-static {v0}, Lcom/instagram/n/d;->a(Ljava/lang/String;)Z

    .line 570
    return-void
.end method

.method public static g(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 651
    const/4 v0, 0x1

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 652
    return-void
.end method

.method private g(Lcom/instagram/pendingmedia/model/c;)V
    .locals 4
    .parameter

    .prologue
    .line 388
    const/4 v1, 0x0

    .line 391
    :try_start_0
    new-instance v0, Lcom/instagram/android/d/g/l;

    invoke-direct {v0, p1}, Lcom/instagram/android/d/g/l;-><init>(Lcom/instagram/pendingmedia/model/c;)V

    .line 392
    invoke-static {}, Lcom/instagram/android/d/a/a;->a()Lcom/instagram/android/d/a/a;

    move-result-object v2

    new-instance v3, Lcom/instagram/android/service/m;

    invoke-direct {v3, p0, p1}, Lcom/instagram/android/service/m;-><init>(Lcom/instagram/android/service/PendingMediaService;Lcom/instagram/pendingmedia/model/c;)V

    invoke-virtual {v2, v0, v3}, Lcom/instagram/android/d/a/a;->a(Lcom/instagram/android/d/c/g;Lcom/instagram/android/d/f/i;)Lch/boye/httpclientandroidlib/HttpResponse;

    move-result-object v1

    .line 399
    if-eqz v1, :cond_0

    invoke-interface {v1}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v0

    invoke-interface {v0}, Lch/boye/httpclientandroidlib/StatusLine;->getStatusCode()I

    move-result v0

    const/16 v2, 0xc8

    if-eq v0, v2, :cond_5

    .line 402
    :cond_0
    const-string v0, "PendingMediaService"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Bad response from server "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 403
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v0

    sget-object v2, Lcom/instagram/model/a/a;->a:Lcom/instagram/model/a/a;

    if-ne v0, v2, :cond_3

    .line 404
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Photo upload failed: "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 414
    :cond_1
    :goto_0
    if-eqz v1, :cond_2

    .line 416
    :try_start_1
    invoke-interface {v1}, Lch/boye/httpclientandroidlib/HttpResponse;->getEntity()Lch/boye/httpclientandroidlib/HttpEntity;

    move-result-object v0

    invoke-static {v0}, Lch/boye/httpclientandroidlib/util/EntityUtils;->consume(Lch/boye/httpclientandroidlib/HttpEntity;)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1

    .line 421
    :cond_2
    :goto_1
    return-void

    .line 405
    :cond_3
    :try_start_2
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v0

    sget-object v2, Lcom/instagram/model/a/a;->b:Lcom/instagram/model/a/a;

    if-ne v0, v2, :cond_1

    .line 406
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Cover photo upload failed: "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_0

    .line 414
    :catchall_0
    move-exception v0

    if-eqz v1, :cond_4

    .line 416
    :try_start_3
    invoke-interface {v1}, Lch/boye/httpclientandroidlib/HttpResponse;->getEntity()Lch/boye/httpclientandroidlib/HttpEntity;

    move-result-object v1

    invoke-static {v1}, Lch/boye/httpclientandroidlib/util/EntityUtils;->consume(Lch/boye/httpclientandroidlib/HttpEntity;)V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0

    .line 418
    :cond_4
    :goto_2
    throw v0

    .line 409
    :cond_5
    :try_start_4
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->b:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Lcom/instagram/pendingmedia/model/e;)V

    .line 410
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    goto :goto_0

    .line 417
    :catch_0
    move-exception v1

    goto :goto_2

    :catch_1
    move-exception v0

    goto :goto_1
.end method

.method private static h(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 627
    sget-object v0, Lcom/instagram/pendingmedia/model/e;->a:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v0}, Lcom/instagram/pendingmedia/model/c;->a(Lcom/instagram/pendingmedia/model/e;)V

    .line 628
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/instagram/android/service/PendingMediaService;->a(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;I)V

    .line 629
    return-void
.end method

.method private h(Lcom/instagram/pendingmedia/model/c;)V
    .locals 3
    .parameter

    .prologue
    .line 425
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->s()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/instagram/android/service/AutoCompleteHashtagService;->a(Ljava/lang/String;)V

    .line 427
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->i(Lcom/instagram/pendingmedia/model/c;)Lcom/instagram/j/l;

    move-result-object v0

    .line 429
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->w()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    sget-object v2, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-ne v1, v2, :cond_0

    .line 430
    invoke-direct {p0, v0, p1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/j/l;Lcom/instagram/pendingmedia/model/c;)V

    .line 432
    :cond_0
    return-void
.end method

.method private i(Lcom/instagram/pendingmedia/model/c;)Lcom/instagram/j/l;
    .locals 11
    .parameter

    .prologue
    const/4 v1, 0x0

    .line 435
    invoke-direct {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->j(Lcom/instagram/pendingmedia/model/c;)Lcom/instagram/android/d/k/d;

    move-result-object v0

    .line 441
    :try_start_0
    invoke-static {}, Lcom/instagram/android/d/a/a;->a()Lcom/instagram/android/d/a/a;

    move-result-object v2

    invoke-virtual {v2, v0}, Lcom/instagram/android/d/a/a;->a(Lcom/instagram/android/d/c/g;)Lch/boye/httpclientandroidlib/HttpResponse;

    move-result-object v5

    .line 443
    if-eqz v5, :cond_c

    invoke-interface {v5}, Lch/boye/httpclientandroidlib/HttpResponse;->getEntity()Lch/boye/httpclientandroidlib/HttpEntity;

    move-result-object v0

    if-eqz v0, :cond_c

    .line 444
    invoke-interface {v5}, Lch/boye/httpclientandroidlib/HttpResponse;->getEntity()Lch/boye/httpclientandroidlib/HttpEntity;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    move-result-object v4

    .line 446
    :try_start_1
    new-instance v0, Lcom/fasterxml/jackson/a/e;

    invoke-direct {v0}, Lcom/fasterxml/jackson/a/e;-><init>()V

    .line 447
    invoke-interface {v4}, Lch/boye/httpclientandroidlib/HttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v6

    .line 448
    invoke-virtual {v0, v6}, Lcom/fasterxml/jackson/a/e;->createParser(Ljava/io/InputStream;)Lcom/fasterxml/jackson/a/l;

    move-result-object v7

    .line 452
    const/4 v0, 0x0

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    .line 453
    new-instance v8, Landroid/os/Bundle;

    invoke-direct {v8}, Landroid/os/Bundle;-><init>()V

    move-object v2, v1

    move-object v3, v1

    .line 455
    :cond_0
    :goto_0
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    move-result-object v9

    sget-object v10, Lcom/fasterxml/jackson/a/r;->c:Lcom/fasterxml/jackson/a/r;

    if-eq v9, v10, :cond_5

    .line 456
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->getCurrentName()Ljava/lang/String;

    move-result-object v9

    .line 458
    const-string v10, "media"

    invoke-virtual {v10, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v10

    if-eqz v10, :cond_1

    .line 459
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    .line 460
    invoke-static {v7}, Lcom/instagram/j/l;->a(Lcom/fasterxml/jackson/a/l;)Lcom/instagram/j/l;

    move-result-object v3

    goto :goto_0

    .line 461
    :cond_1
    const-string v10, "message"

    invoke-virtual {v10, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v10

    if-eqz v10, :cond_2

    .line 462
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    .line 463
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->getText()Ljava/lang/String;

    move-result-object v2

    goto :goto_0

    .line 464
    :cond_2
    const-string v10, "checkpoint_url"

    invoke-virtual {v10, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v10

    if-eqz v10, :cond_3

    .line 465
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    .line 466
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->getText()Ljava/lang/String;

    move-result-object v1

    goto :goto_0

    .line 467
    :cond_3
    const-string v10, "feedback_required"

    invoke-virtual {v10, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v10

    if-eqz v10, :cond_4

    .line 468
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    .line 469
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->getBooleanValue()Z

    move-result v0

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    goto :goto_0

    .line 470
    :cond_4
    if-eqz v9, :cond_0

    .line 471
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->nextToken()Lcom/fasterxml/jackson/a/r;

    .line 472
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->getText()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v8, v9, v10}, Landroid/os/Bundle;->putString(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 502
    :catchall_0
    move-exception v0

    move-object v1, v4

    .line 503
    :goto_1
    :try_start_2
    invoke-static {v1}, Lch/boye/httpclientandroidlib/util/EntityUtils;->consume(Lch/boye/httpclientandroidlib/HttpEntity;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    .line 506
    :goto_2
    throw v0

    .line 476
    :cond_5
    :try_start_3
    invoke-virtual {v7}, Lcom/fasterxml/jackson/a/l;->close()V

    .line 477
    invoke-virtual {v6}, Ljava/io/InputStream;->close()V

    .line 479
    invoke-interface {v5}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v6

    if-eqz v6, :cond_6

    invoke-interface {v5}, Lch/boye/httpclientandroidlib/HttpResponse;->getStatusLine()Lch/boye/httpclientandroidlib/StatusLine;

    move-result-object v6

    invoke-interface {v6}, Lch/boye/httpclientandroidlib/StatusLine;->getStatusCode()I

    move-result v6

    const/16 v7, 0xc8

    if-eq v6, v7, :cond_a

    .line 480
    :cond_6
    const-string v6, "PendingMediaService"

    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v9, "Failure response on configure: "

    invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 483
    const-string v6, "checkpoint_required"

    invoke-virtual {v6, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_9

    .line 484
    const-string v5, "Failed on configure: checkpoint required"

    invoke-direct {p0, p1, v5}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 485
    invoke-direct {p0, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Ljava/lang/String;)V

    .line 497
    :goto_3
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-nez v0, :cond_7

    const-string v0, "feedback_required"

    invoke-virtual {v0, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_8

    .line 498
    :cond_7
    invoke-static {v8}, Lcom/instagram/android/h/d;->a(Landroid/os/Bundle;)V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 503
    :cond_8
    :goto_4
    :try_start_4
    invoke-static {v4}, Lch/boye/httpclientandroidlib/util/EntityUtils;->consume(Lch/boye/httpclientandroidlib/HttpEntity;)V
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0

    .line 509
    :goto_5
    return-object v3

    .line 487
    :cond_9
    :try_start_5
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Failed on configure: "

    invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    goto :goto_3

    .line 490
    :cond_a
    if-eqz v2, :cond_b

    const-string v1, "media_needs_reupload"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_b

    .line 491
    const-string v1, "Failed on configure: Media needs reupload"

    invoke-direct {p0, p1, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;Ljava/lang/String;)V

    .line 492
    invoke-static {p0, p1}, Lcom/instagram/android/service/PendingMediaService;->h(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;)V

    goto :goto_3

    .line 494
    :cond_b
    sget-object v1, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {p1, v1}, Lcom/instagram/pendingmedia/model/c;->a(Lcom/instagram/pendingmedia/model/e;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    goto :goto_3

    .line 504
    :catch_0
    move-exception v0

    .line 505
    const-string v0, "PendingMediaService"

    const-string v1, "Entity could not be consumed."

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_5

    .line 504
    :catch_1
    move-exception v1

    .line 505
    const-string v1, "PendingMediaService"

    const-string v2, "Entity could not be consumed."

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_2

    .line 502
    :catchall_1
    move-exception v0

    goto/16 :goto_1

    :cond_c
    move-object v3, v1

    move-object v4, v1

    goto :goto_4
.end method

.method private j(Lcom/instagram/pendingmedia/model/c;)Lcom/instagram/android/d/k/d;
    .locals 1
    .parameter

    .prologue
    .line 514
    .line 515
    invoke-virtual {p1}, Lcom/instagram/pendingmedia/model/c;->M()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 516
    new-instance v0, Lcom/instagram/android/directshare/b/a/g;

    invoke-direct {v0, p1}, Lcom/instagram/android/directshare/b/a/g;-><init>(Lcom/instagram/pendingmedia/model/c;)V

    .line 520
    :goto_0
    return-object v0

    .line 518
    :cond_0
    new-instance v0, Lcom/instagram/android/d/g/f;

    invoke-direct {v0, p1}, Lcom/instagram/android/d/g/f;-><init>(Lcom/instagram/pendingmedia/model/c;)V

    goto :goto_0
.end method


# virtual methods
.method public b()V
    .locals 2

    .prologue
    .line 369
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    if-eqz v0, :cond_0

    .line 370
    const-string v0, "PendingMediaService"

    const-string v1, "Cancelling Final Render"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 371
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/a;->a()V

    .line 373
    :cond_0
    return-void
.end method

.method public c()V
    .locals 1

    .prologue
    .line 376
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    if-eqz v0, :cond_0

    .line 377
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->c:Lcom/instagram/creation/video/h/a;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/a;->h()V

    .line 379
    :cond_0
    return-void
.end method

.method public onBind(Landroid/content/Intent;)Landroid/os/IBinder;
    .locals 1
    .parameter "intent"

    .prologue
    .line 153
    iget-object v0, p0, Lcom/instagram/android/service/PendingMediaService;->a:Landroid/os/IBinder;

    return-object v0
.end method

.method public onCreate()V
    .locals 0

    .prologue
    .line 148
    invoke-super {p0}, Landroid/app/IntentService;->onCreate()V

    .line 149
    return-void
.end method

.method public onDestroy()V
    .locals 0

    .prologue
    .line 574
    invoke-virtual {p0}, Lcom/instagram/android/service/PendingMediaService;->b()V

    .line 575
    invoke-virtual {p0}, Lcom/instagram/android/service/PendingMediaService;->c()V

    .line 576
    invoke-direct {p0}, Lcom/instagram/android/service/PendingMediaService;->f()V

    .line 577
    invoke-super {p0}, Landroid/app/IntentService;->onDestroy()V

    .line 578
    return-void
.end method

.method protected onHandleIntent(Landroid/content/Intent;)V
    .locals 3
    .parameter "intent"

    .prologue
    .line 159
    :try_start_0
    const-string v0, "PendingMediaService.INTENT_EXTRA_PERFORM_ACTION"

    const/4 v1, 0x0

    invoke-virtual {p1, v0, v1}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v0

    .line 160
    const-string v1, "PendingMediaService.INTENT_EXTRA_PENDING_MEDIA_ID"

    invoke-virtual {p1, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 161
    sget-object v2, Lcom/instagram/android/service/PendingMediaService;->d:Lcom/instagram/pendingmedia/b/a;

    invoke-virtual {v2, v1}, Lcom/instagram/pendingmedia/b/a;->a(Ljava/lang/String;)Lcom/instagram/pendingmedia/model/c;

    move-result-object v1

    .line 163
    if-nez v1, :cond_1

    .line 164
    const-string v0, "PendingMediaService"

    const-string v1, "Pending media did not exist on handle intent"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 174
    :cond_0
    :goto_0
    sget-object v0, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/b/c;->c()V

    .line 176
    return-void

    .line 166
    :cond_1
    const/4 v2, 0x1

    if-ne v0, v2, :cond_2

    .line 167
    :try_start_1
    invoke-static {v1}, Lcom/instagram/creation/video/j/k;->a(Lcom/instagram/pendingmedia/model/c;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 174
    :catchall_0
    move-exception v0

    sget-object v1, Lcom/instagram/android/service/PendingMediaService;->e:Lcom/instagram/pendingmedia/b/c;

    invoke-virtual {v1}, Lcom/instagram/pendingmedia/b/c;->c()V

    throw v0

    .line 168
    :cond_2
    if-nez v0, :cond_0

    .line 169
    :try_start_2
    invoke-direct {p0, v1}, Lcom/instagram/android/service/PendingMediaService;->a(Lcom/instagram/pendingmedia/model/c;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_0
.end method
